import Task from '../../class/task'
import taskTag from "../../class/taskTag";
import { listActionTypes, listReducer, listAction } from '../../utility/listAction';
import { createContext, useEffect, useReducer, useState, useMemo } from 'react';
import { Dialog, Button, BackTop } from '@nutui/nutui-react-taro';
import { DEBUGTAGS, DEBUGTASKS } from '../../utility/debugValues'
import Time from '../../class/time';
import { defaultTask } from '../../utility/variables';
import { Text } from '@tarojs/components';

export const tasksDispatcherContext = createContext((_: listAction<Task>)=>{})
export const tagsDispatcherContext = createContext((_: listAction<taskTag>)=>{})
export const tagsContext = createContext([] as taskTag[])

export function Main(){
    //DEBUG INIT THE task from settings
    const [tasks, tasksDispatcher] = useReducer(listReducer<Task>, DEBUGTASKS)
    const [tags, tagsDispatcher] = useReducer(listReducer<taskTag>, DEBUGTAGS)
    //END

    return (
        <>
            <tasksDispatcherContext.Provider value={tasksDispatcher}>
            <tagsDispatcherContext.Provider value={tagsDispatcher}>
            <tagsContext.Provider value={tags}>
            </tagsContext.Provider>
            </tagsDispatcherContext.Provider>
            </tasksDispatcherContext.Provider>
        </>
    )
}
